home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PD Collection CD 1
/
PD Collection CD 1.iso
/
data
/
powerbas
/
UserFuncs
(
.txt
)
< prev
Wrap
RISC OS BBC BASIC V Source
|
1995-04-01
|
3KB
|
106 lines
>&.Keep.UserFuncs
Uageinyrs(date1$,date2$)
--- v.02
--- date1$ & date2$ in format : "DD-MM-YY" or "DD-MM-YYYY"
--- Does NOT handle century wrap-around !!
d1%,d2%,m1%,m2%,y1%,y2%,age%,age$ : age$=""
date1$<>""
date2$<>""
> d1%=
date1$,2)):m1%=
date1$,4,2)):y1%=
date1$,2))
> d2%=
date2$,2)):m2%=
date2$,4,2)):y2%=
date2$,2))
y2%<y1%
(y2%=y1%
m2%<m1%)
(y2%=y1%
m2%=m1%
d2%<d1%)
age$="--"
age%=y2%-y1%
(m2%<m1%) : age%-=1
,
(m2%=m1%)
(d2%<d1%) : age%-=1
age$=
(age%)
=age$
Udate8(d%,m%,y%)
--- v.01
--- Returns a string (DD-MM-YY) from the day, month and year
integer parameters d%, m%, and y% respectively.
Returns null string if any parameter = 0 (or is an empty field)
date$,d$,m$,y$ : date$=""
d%>0
d%<32
m%>0
m%<13
y%>0
y%<100
! d$=
(d%):m$=
(m%):y$=
d%<10 d$="0"+d$
m%<10 m$="0"+m$
y%<10 y$="0"+y$
date$=d$+"-"+m$+"-"+y$
=date$
Unow(t$)
--- v.01
--- Returns current date in format : "DD-MM-YY"
mon$,m$ : mon$=
$,8,3)
mon$
"Jan" : m$="01"
"Feb" : m$="02"
"Mar" : m$="03"
"Apr" : m$="04"
"May" : m$="05"
"Jun" : m$="06"
"Jul" : m$="07"
"Aug" : m$="08"
"Sep" : m$="09"
"Oct" : m$="10"
"Nov" : m$="11"
"Dec" : m$="12"
: m$="??"
$,5,2)+"-"+m$+"-"+
$,14,2)
Uname(surname$,forename$,middlenames$)
### Returns name as forename$ <space> surname$ UNLESS one of ###
### middle names is immediately followed by an asterisk, in ###
### which case the indicated name is used in place of forename$ ###
P%,Q%,N$
middlenames$,"*")
P%=0
N$=forename$+" "+surname$
Q%=P%
Q%-=1
Q%=0
middlenames$,Q%,1)=" "
H1 N$=
middlenames$,Q%+1,P%-Q%-1)+" "+surname$
Uday(date$)
day%,day$,suffix$
day%=
(date$)
day%
1,21,31:suffix$="st"
2,22:suffix$="nd"
3,23:suffix$="rd"
:suffix$="th"
(day%)+suffix$
Umonth(date$)
month%,months$
Yzmonths$="January February March April May June July August SeptemberOctober November December "
month%=
date$,4,2))
months$,month%*9-8,9)